# -*- coding: utf-8 -*-
"""
 @Time    : 2021/2/6 下午5:12
 @Author  : tgy
 
"""
import socket
import threading
import time

address = ('127.0.0.1', 8083)


class Connect:
    ...

    def __init__(self, address):
        self.address = address
        self.socket = None

    def connect(self,index):
        ...
        self.socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM)
        print('connect')
        self.socket.connect(self.address)

        while True:
            ...
            print(f'index:{index}')
            time.sleep(1000000)
            # self.socket.send(b'aaa')
            # recv = self.socket.recv(1024)
            # encode_recv = recv.decode('utf-8')
            # print(f'index:{index},recv content: {encode_recv}')
            # time.sleep(1)


def run(index):
    ...
    print('123')
    connect = Connect(address)
    connect.connect(index)


def test01():
    ...
    for i in range(10):
        ...
        thread = threading.Thread(target=run,args=(i + 1,))
        thread.start()


if __name__ == '__main__':
    ...
    test01()
